/**
 * Created by billy on 2017/4/25.
 */
var g = require("nodeLib");
var _sql;
var _file = g.data.file.get("user");
var arr = [];
var tool = require("../utils/tool");
module.exports = class {
	constructor()
	{
		_file.add(__projpath("./module/sql/user"));
		_sql = g.data.manager.getManager("myGameClass");
		this.add("getList", this.getList);
		this.add("getForm", this.getForm);
		this.add("getGame", this.getGame);
		this.add("getArea", this.getArea);
	}

	getList($data, $success, $error, $client)
	{

		var sqlStr = _file.get("getStatic_form_getList.sql");
//		var sqlStr = _file.get("getaBase_form_getList.sql");
		_sql.query(sqlStr, ($list) => {
			g.fs.mkdirSync(__projpath("10"))
			g.fs.writeFileSync(__projpath("10/form.json"), JSON.stringify($list));
			$success($list);

		})
	}
	getForm($data, $success, $error, $client){

		var sqlStr = _file.get("getBase_form_getList.sql");
		_sql.query(sqlStr, ($list) => {
			g.fs.mkdirSync(__projpath("11"))
			g.fs.writeFileSync(__projpath("11/form.json"), JSON.stringify($list));
			$success($list);

		})
	}
	getGame($data, $success, $error, $client){

		var sqlStr = _file.get("getBase_game_getList.sql");
		_sql.query(sqlStr, ($list) => {
			g.fs.mkdirSync(__projpath("12"))
			g.fs.writeFileSync(__projpath("12/form.json"), JSON.stringify($list));
			$success($list);
		})
	}
	getArea($data, $success, $error, $client){

		var sqlStr = _file.get("getStatic_area_getList.sql");
		_sql.query(sqlStr, ($list) => {
			g.fs.mkdirSync(__projpath("13"))
			g.fs.writeFileSync(__projpath("13/area.json"), JSON.stringify($list));
			$success($list);
		})
	}
}
